<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 

$paypal_email = $mw_cash[cf_paypal_email];
$amount = sprintf("%.2f", $cash_list[cl_payment]); // 달라!

if ($amount < 0.01)
    alert("0.01 달라 이상 결제 가능합니다.");

$return = "$g4[url]/plugin/cybercash/cash-charge-complete.php";
$cancel_return = "$g4[url]/plugin/cybercash/paypal_cancel.php";
$notify_url = "$g4[url]/plugin/cybercash/pg.paypal.update.php";

if ($is_paypal_test)
    $paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
else
    $paypal_url = "https://www.paypal.com/cgi-bin/webscr";

if (!$complete_url)
    $complete_url = $return;

if (!$pay_name)
    $pay_name = $mw_cash['cf_cash_name'];
?>

<form name="mainForm" method="post" action="<?=$paypal_url?>">
<input type="hidden" name="cmd" value="_xclick"/>
<input type="hidden" name="business" value="<?=$paypal_email?>"/> <!-- 상점의 계정 (이메일) -->
<input type="hidden" name="item_name" value="<?=$pay_name?>"/> <!-- 상품명 -->
<input type="hidden" name="amount" value="<?=$amount?>"/> <!-- 결제금액 -->
<input type="hidden" name="invoice" value="C<?=$cl_id?>"/> <!-- 결제고유번호 -->
<input type="hidden" name="no_shipping" value="1"/> <!-- 배송주소 사용여부 (0:보임,선택입력 / 1:사용안함 / 2:필수입력) -->
<input type="hidden" name="charset" value="<?=$g4[charset]?>"/> 
<input type="hidden" name="image_url" value=""/> <!-- 결제창 상단로고 -->
<input type="hidden" name="return" value="<?=$complete_url?>"/> <!-- 결제완료 후 돌아갈 url -->
<input type="hidden" name="cancel_return" value="<?=$cancel_return?>"/> <!-- 결제취소 후 돌아갈 url -->
<input type="hidden" name="notify_url" value="<?=$notify_url?>"/> <!-- IPN 메세지를 받을 페이지 URL -->
<input type="hidden" name="custom" value=""/> <!-- 기타  -->
</form>

<script type="text/javascript">
function openWindow() {
    self.resizeTo(950,600);
    if (!parent.name)
        mainForm.target=top;
    $("#payment-button").text("페이팔로 이동중입니다. 잠시만 기다려주세요.");
    mainForm.submit();
}
</script> 

<?
include_once("$g4[path]/tail.sub.php");
